package com.ruoyi.monitor.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.monitor.domain.PreModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.monitor.mapper.PreModelMapper;
import com.ruoyi.monitor.service.IPreModelService;

/**
 * 模型预测Service业务层处理
 * 
 * @author xzx
 * @date 2023-04-22
 */
@Service
public class PreModelServiceImpl extends ServiceImpl<PreModelMapper, PreModel> implements IPreModelService
{
    @Autowired
    private PreModelMapper preModelMapper;

    @Override
    public PreModel selectPreModelByName(String name) {
        LambdaQueryWrapper<PreModel> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PreModel::getName,name);
        return preModelMapper.selectOne(wrapper);
    }

    /**
     * 查询模型预测
     * 
     * @param id 模型预测主键
     * @return 模型预测
     */
    @Override
    public PreModel selectPreModelById(Long id)
    {
        return preModelMapper.selectPreModelById(id);
    }

    /**
     * 查询模型预测列表
     * 
     * @param preModel 模型预测
     * @return 模型预测
     */
    @Override
    public List<PreModel> selectPreModelList(PreModel preModel)
    {
        return preModelMapper.selectPreModelList(preModel);
    }

    /**
     * 新增模型预测
     * 
     * @param preModel 模型预测
     * @return 结果
     */
    @Override
    public int insertPreModel(PreModel preModel)
    {
        preModel.setCreateTime(DateUtils.getNowDate());
        return preModelMapper.insertPreModel(preModel);
    }

    /**
     * 修改模型预测
     * 
     * @param preModel 模型预测
     * @return 结果
     */
    @Override
    public int updatePreModel(PreModel preModel)
    {
        return preModelMapper.updatePreModel(preModel);
    }

    /**
     * 批量删除模型预测
     * 
     * @param ids 需要删除的模型预测主键
     * @return 结果
     */
    @Override
    public int deletePreModelByIds(Long[] ids)
    {
        return preModelMapper.deletePreModelByIds(ids);
    }

    /**
     * 删除模型预测信息
     * 
     * @param id 模型预测主键
     * @return 结果
     */
    @Override
    public int deletePreModelById(Long id)
    {
        return preModelMapper.deletePreModelById(id);
    }
}
